__author__ = 'Wir'
import pygame

import player, screen, shot

TEST GIT
class main():
    pygame.init()
    ''' xsize = 1024
        ysize = 786
        screen = pygame.display.set_mode((xsize, ysize))'''
        
        
    def __init__(self):
        self.sc = screen.screen()
        self.pl = player.player()
        self.sh = shot.shot()

                

        #x = 1024/2
        #y = 786-65
        clock = pygame.time.Clock()
        surface = pygame.Surface((100, 100), pygame.SRCALPHA)
        ''' image = pygame.image.load('ball.png')'''
        self.pl.load_playerImage()
        ''' shot_obj  = None
            shot_objx = 0
            shot_objy = 0'''
        self.sh.init_shot()
        
        
        done = False     
        while not done:
           
    
            # will block execution until 1/60 seconds have passed
            # since the previous time clock.tick was called.
            clock.tick(60)
            for event in pygame.event.get():
                    if event.type == pygame.QUIT:
                            done = True
    
            #Spiel
    
            #pygame.draw.rect(screen, (255,0,0), pygame.Rect(x,y,20,20))
            'screen.fill((0, 0, 0)) already done in screen.screen.init_screen()'
            '''screen.blit(pygame.image.load('ball.png'), (x, y))'''
            self.pl.draw_player()
            pressed = pygame.key.get_pressed()
            #if pressed[pygame.K_UP]: y -= 3
            #if pressed[pygame.K_DOWN]: y += 3
            if pressed[pygame.K_LEFT] and (self.pl.posX > 0):
                self.pl.player_moveLeft(10)
            if pressed[pygame.K_RIGHT] and (self.pl.posX < self.pl.posX-50):
                self.pl.player_moveRight(10)
    
            if pressed[pygame.K_UP] and (self.sh.shot_obj == None):
                '''shot_objx = player.player.posX+25;
                shot_objy = player.player.posY+25;
                shot_obj = screen.blit(pygame.image.load('bullet2.png'), (shot_objx, shot_objy))
                
                if shot_obj:
                shot_objy -= 20
                img = pygame.image.load('bullet2.png')
                img = pygame.transform.scale(img, (10,42) )
                shot_obj = screen.blit(img, (shot_objx, shot_objy))
    
                if shot_objx > xsize or shot_objy > ysize:
                    shot_obj = None
                if shot_objx < 0 or shot_objy < 0:
                    shot_obj = None'''
                self.sh.do_shot()
    
            '''pygame.display.update() #Screen refresh'''
            self.sc.update_screen()
        
main = main()